﻿
Public Class Service

    Private Const AudioServiceName As String = "Audiosrv"
    Dim SController As New ServiceProcess.ServiceController
    Public Sub StartService(ByVal ServiceName As String)
        SController.ServiceName = ServiceName
        If ServiceName <> "" Then
            If SController.Status = Not ServiceProcess.ServiceControllerStatus.Running Then
                SController.Start()
            End If
        End If
    End Sub

    Public Sub StopService(ByVal ServiceName As String)
        SController.ServiceName = ServiceName
        If ServiceName <> "" Then
            If SController.Status = Not ServiceProcess.ServiceControllerStatus.Stopped Then
                SController.Stop()
            End If
        End If
    End Sub

    Public Sub StopAudioService()
        SController.ServiceName = AudioServiceName
        If SController.Status = Not ServiceProcess.ServiceControllerStatus.Stopped Then
            SController.Stop()
        End If
    End Sub

    Public Sub StartAudioService()
        SController.ServiceName = AudioServiceName
        If SController.Status = Not ServiceProcess.ServiceControllerStatus.Running Then
            SController.Start()
        End If
    End Sub
End Class
